package com.liser.southernstar.ui.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liser.southernstar.R;
import com.liser.southernstar.model.vo.GoodsGroupedItem;
import com.liser.southernstar.ui.widget.ElemeAddWidget;

/**
 * 已点商品适配器
 *
 * @author LISER
 * @date 2020-01-11 16:05
 */
public class GoodsOrderedAdapter extends BaseQuickAdapter<GoodsGroupedItem, BaseViewHolder> {

    private ElemeAddWidget.OnAddClickListener onAddClickListener;

    public GoodsOrderedAdapter(ElemeAddWidget.OnAddClickListener onAddClickListener) {
        super(R.layout.adapter_goods_ordered);
        this.onAddClickListener = onAddClickListener;
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsGroupedItem goodsGroupedItem) {
        helper.setText(R.id.car_name, goodsGroupedItem.getName())
                .setText(R.id.car_price, goodsGroupedItem.getStrPrice(mContext));
        ElemeAddWidget elemeAddWidget = helper.getView(R.id.eleme_add_widget);
        elemeAddWidget.setData(onAddClickListener, goodsGroupedItem);
    }
}
